package com.shuzixiangcun.service.front;

import com.shuzixiangcun.dao.XiangcunzhiliDao;
import com.shuzixiangcun.entity.Xiangcunzhili;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 乡村治理表(Xiangcunzhili)表服务实现类
 *
 * @author makejava
 * @since 2024-06-24 08:26:18
 */
@Service
public class XiangcunzhiliFServiceImpl {
    @Resource
    private XiangcunzhiliDao xiangcunzhiliDao;

    /**
     * 通过ID查询单条数据
     *
     * @param governanceId 主键
     * @return 实例对象
     */

    public Xiangcunzhili queryById(Object governanceId) {
        return this.xiangcunzhiliDao.queryById(governanceId);
    }




    /**
     * 新增数据
     *
     * @param xiangcunzhili 实例对象
     * @return 实例对象
     */

    public Xiangcunzhili insert(Xiangcunzhili xiangcunzhili) {
        this.xiangcunzhiliDao.insert(xiangcunzhili);
        return xiangcunzhili;
    }

    /**
     * 修改数据
     *
     * @param xiangcunzhili 实例对象
     * @return 实例对象
     */

    public Xiangcunzhili update(Xiangcunzhili xiangcunzhili) {
        this.xiangcunzhiliDao.update(xiangcunzhili);
        return this.queryById(xiangcunzhili.getGovernanceId());
    }

    /**
     * 通过主键删除数据
     *
     * @param governanceId 主键
     * @return 是否成功
     */

    public boolean deleteById(Object governanceId) {
        return this.xiangcunzhiliDao.deleteById(governanceId) > 0;
    }
}
